#include <iostream>
using namespace std;

int main(void)
{
    int n, s = 3, r = 1;
    cout << "ernter n: ";
    cin >> n;

    while(r * s <= n)
        r *= s;

    if (r == n)
        cout <<"true";
    else
        cout << "false";

    return 0;
}
